<!DOCTYPE html>
<html lang="en">
<head>
<title><#:C('sitename')#>--用户注册</title>
<meta name="keywords" content="<#:C('keyword')#>"/>
<meta name="description" content="<#:C('content')#>"/>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<link rel="stylesheet" href="<#$Theme['P']['root']#>/matrix/css/bootstrap-responsive.min.css" />
<link rel="stylesheet" href="<#$Theme['P']['root']#>/matrix/css/matrix-reg.css" />
<link href="<#$Theme['P']['root']#>/matrix/font-awesome/css/font-awesome.css" rel="stylesheet" />
<link href='/AUI/Public/googlefont.css?family=Open+Sans:400,700,800' rel='stylesheet' type='text/css'>
  <link href="/reg/assets/rptk_css/rptk-cloud.css" rel="stylesheet" />
    </head>
<body>

<div class="navbar navbar-default" role="navigation">
<div class="container">
  <div class="navbar-header">
    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
      <span class="sr-only">Toggle navigation</span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
    </button>
    <a class="navbar-brand" href="/"><img src="/AUI/Index/new/images/ss.jpg"></a>
  </div>
  <div class="collapse navbar-collapse" id="navbar-collapse">
      <div class="navbar-right">
        <p class="navbar-text mg-rt">已经有账号了？</p>
        <a href="#" class="btn btn-primary navbar-btn navbar-btn-mw" id="btn_login">登陆</a>
      </div>
  </div>
</div>
</div>

<div class="container-fluid">
    <div class="container rptk-cloud-register">
        <div class="register-header">
          <h2>创建一个新账号</h2>
          <h4>通过云端账号您能很方便的查看数据，管理网络</h4>
        </div>
        <div class="register-tabs cf">
          <button type="button" class="btn btn-primary" id="regway">以个人名义注册账号</button>
        </div>
        <div class="register-body page-register-content">
            <form id="loginform" class="form-vertical" >
                <div class="alert " id="msgbox" style="float:right; position: absolute; right: 100px;">
                   <div id="alertmsg"></div>
                </div>
                <div class="form-group clearfix">
                <label for="" class="col-sm-1 control-label">用户名：</label>
                <div class="col-sm-4">
                <input autofocus="autofocus" class="form-control input-df" id="txt_user" name="txt_user" type="text" value="" />
                </div>
                <div class="col-sm-6 control-tips">
                <span class="text-red">*</span> 请输入1-16位数字、字母或下划线
                </div>
                </div>
                <div class="form-group clearfix">
                <label for="" class="col-sm-1 control-label">密码：</label>
                <div class="col-sm-4">
                <input autocomplete="off" class="form-control input-df" data-rule="密码: required;password;" id="password" name="password" type="password" />
                </div>
                <div class="col-sm-6 control-tips">
                <span class="text-red">*</span> 密码长度6-30位
                </div>
                </div>
                <div class="form-group clearfix">
                <label for="" class="col-sm-1 control-label">密码确认：</label>
                <div class="col-sm-4">
                <input autocomplete="off" class="form-control input-df" data-rule="确认密码: required;match(user[password]);" id="repassword" name="repassword" type="password" />
                </div>
                <div class="col-sm-6 control-tips">
                <span class="text-red">*</span> 请再次确认密码
                </div>
                </div>
                <div class="form-group clearfix">
                <label for="" class="col-sm-1 control-label">联系人：</label>
                <div class="col-sm-4">
                <input class="form-control input-df" data-rule="联系人:required;length[1~16]" id="linker" name="linker" type="text" value="" />
                </div>
                <div class="col-sm-6 control-tips">
                <span class="text-red">*</span> 请填写联系人名称，1-16字
                </div>
                </div>
                <div class="form-group clearfix">
                <label for="" class="col-sm-1 control-label">手机号：</label>
                <div class="col-sm-4">
                <input class="form-control input-df" data-rule="手机号:required;mobile" id="phone" name="phone" type="text" value="" />
                </div>
                <div class="col-sm-6 control-tips">
                <span class="text-red">*</span> 请填写正确的手机号码
                </div>
                </div>
                <div class="company-input">
                <input class="input-txt input-df" id="user_agent_info_attributes_category" name="user[agent_info_attributes][category]" type="hidden" value="company" />
                <div class="form-group clearfix">
                <label for="" class="col-sm-1 control-label">公司名称：</label>
                <div class="col-sm-4">
                  <input class="form-control input-df" data-rule="公司名称:required;length[2~32]" id="shopname" name="shopname" type="text" />
                </div>
                <div class="col-sm-6 control-tips">
                  <span class="text-red">*</span> 请填写公司名称，2-32字
                </div>
                </div>
                </div>
                <div class="form-group clearfix">
                <div class="col-sm-offset-1 col-sm-2">
                <button type="button" class="btn btn-primary btn-df btn-block" id="btn_reg">立即注册</button>
                </div>
                </div>
                <div class="form-group clearfix">
                <div class="col-sm-offset-1 col-sm-10">
                <input type="hidden" name="doact" id="doact" value="doreg"/> 点击 “立即注册” 即表示您同意 <a href="#" target="_blank" class="c-4796EE">《新用户注册协议》</a>
                </div>
                </div>
            </form>
        </div>
    </div>
</div>
    <footer class="container-fluid">
        <div class="container">
          Copyright © 2014 深圳神行通科技技术有限公司 All Rights Reserved
        </div>
    </footer>
    <script src="<#$Theme['P']['root']#>/matrix/js/jquery.min.js"></script>
    <script src="<#$Theme['P']['root']#>/matrix/js/common.js"></script>
    <script type="text/javascript">
        document.onkeydown=function(event){
          e = event ? event :(window.event ? window.event : null);
          if(e.keyCode==13){
           //执行的方法
            $('#btn_reg').click();
          }
        }
         $(function(){
             $('#btn_login').bind('click',function(){
                    location.href="<#:U('index/index/log')#>";
                });
            $('#btn_reg').bind('click',function(){
                var u=$('#txt_user').val();
                var p=$('#password').val();
                var pc=$('#repassword').val();
                var s=$('#shopname').val();
                var link=$('#linker').val();
                var phone=$('#phone').val();
                var act=$('#doact').val();
                if(u == "") {AlertTips("请输入帐号", 2000);return false;}
                if(p == "") {AlertTips("请输入密码", 2000);return false;}
                if(p!=pc) {AlertTips("确认密码不正确", 2000);return false;}
                if(s == "") {AlertTips("商户名称不能为空", 2000);return false;}
                if(link == "") {AlertTips("联系人不能为空", 2000);return false;}
                if(!isaccount(u)) {AlertTips("帐号由4～20位数字或字母组成", 2000);return false;}
                if(!isPhone(phone)) {AlertTips("请输入11位手机号码", 2000);return false;}
                $.ajax({
                    url: "<#:U('Login/doregist')#>",
                    type: "post",
                    data:{
                        'account':u,
                        'password':p,
                        'repassword':pc,
                        'shopname':s,
                        'linker':link,
                        'phone':phone,
                        'doact':act,
                        '__hash__':$('input[name="__hash__"]').val()
                        },
                    dataType:'json',
                    error:function(){AlertTips("服务器忙，请稍候再试", 3000);},
                    success:function(data){
                        if(data.error==0){
                            location.href=data.url;
                        }else{
                            AlertTips(data.msg, 3000);
                        }
                    }
                  });
            });
         });
    </script>
</body>
</html>


